package com.kmproject.haifu.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import com.jess.arms.di.scope.ActivityScope;

import javax.inject.Inject;

import com.kmproject.haifu.mvp.contract.HousePublishOfficePublishContract;
import com.kmproject.haifu.mvp.model.api.service.UserService;
import com.kmproject.haifu.mvp.model.entity.ResultBean;
import com.kmproject.haifu.mvp.model.entity.beans.HousePayWayBean;
import com.kmproject.haifu.mvp.model.entity.beans.HousePublishResultBean;
import com.kmproject.haifu.mvp.model.entity.beans.HouseRentListShowInfoBean;
import com.kmproject.haifu.mvp.model.entity.beans.MyStoryBean;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 08/07/2019 15:28
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
@ActivityScope
public class HousePublishOfficePublishModel extends BaseModel implements HousePublishOfficePublishContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;
    UserService userService;
    @Inject
    public HousePublishOfficePublishModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
        userService=repositoryManager.obtainRetrofitService(UserService.class);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<ResultBean<List<HousePayWayBean>>> getHousePayWayBean(String value, String category) {
        return userService.dictList(value,category);
    }

    @Override
    public Observable<ResultBean<List<HousePayWayBean>>> getAreaTree(String url, String value, String category) {
        return userService.getAreaTree(url,value,category);
    }

    @Override
    public Observable<ResultBean<List<MyStoryBean.ResultBean>>> querySelectStory(Map<String,Object> maps) {
        return userService.querySelectStory(creatRequestBody(maps,mGson));
    }

    @Override
    public Observable<ResultBean> addHouseRent(Map<String, Object> params) {
        return userService.addHouseRent(creatRequestBody(params,mGson));
    }

    @Override
    public Observable<ResultBean<List<HousePayWayBean>>> getFloorTypeAndFloor() {
        return userService.getFloorTypeAndFloor();
    }
    @Override
    public Observable<ResultBean> updateHouseRent(Map<String, Object> maps) {
        return userService.updateHouseRent(creatRequestBody(maps,mGson));
    }
    @Override
    public Observable<ResultBean<HouseRentListShowInfoBean>> viewHouseRent(String url) {
        return userService.viewHouseRent(url);
    }

}